<template>
<div style="width: 100%">
  <a-card class="card" :bordered="false">
    <div class="table-page-search-wrapper">
      <a-form layout="vertical">
        <a-row :gutter="48">
          <a-col :sm="{span:12}" :lg="{span:6}" :xl="{span:6}">
            <a-form-item label="考次">
              <a-select :allowClear="true" v-model="queryParam.sznj">
                <a-select-option v-for="i in TYPE0126" :key="i.id" :value="i.code">{{ i.name }}</a-select-option>
              </a-select>
            </a-form-item>
          </a-col>
          <a-col :sm="{span:12}" :lg="{span:6}" :xl="{span:6}">
            <a-form-item label="考区">
              <a-select :allowClear="true" v-model="queryParam.sznj">
                <a-select-option v-for="i in TYPE0126" :key="i.id" :value="i.code">{{ i.name }}</a-select-option>
              </a-select>
            </a-form-item>
          </a-col>
          <template v-if="advanced">
          <a-col :sm="{span:12}" :lg="{span:6}" :xl="{span:6}">
            <a-form-item label="开始时间">
              <a-date-picker @change="handleDateChange" />
            </a-form-item>
          </a-col>
          <a-col :sm="{span:12}" :lg="{span:6}" :xl="{span:6}">
            <a-form-item label="结束时间">
              <a-date-picker @change="handleDateChange" />
            </a-form-item>
          </a-col>
          <a-col :sm="{span:12}" :lg="{span:6}" :xl="{span:6}">
            <a-form-item label="备注">
              <a-input placeholder="请输入..." ></a-input>
            </a-form-item>
          </a-col>
          </template>
          <a-col :sm="{span:16}" :xl="{span:8}">
            <a-button type="primary" @click="handleClear">清除已分配数据</a-button>
            <a-button type="primary" @click="handleDistribution">分配监考</a-button>
            <a @click="advanced = !advanced" style="margin-left: 8px">
                {{ advanced ? '收起' : '展开' }}
                <a-icon :type="advanced ? 'up' : 'down'"/>
              </a>
          </a-col>
        </a-row>
      </a-form>
    </div>
    </a-card>
    <a-card class="card" :bordered="false">
      <a-row :gutter="48">
          <a-col :sm="{span:12}" :lg="{span:12}" :xl="{span:12}">
            <span>考次共有</span>
            <a-input-number :min="1" :max="10" />
            <span>考场</span>
          </a-col>
          <a-col :sm="{span:12}" :lg="{span:12}" :xl="{span:12}">
            <span>已分配监考</span>
            <a-input-number :min="1" :max="10" />
            <span>人</span>
          </a-col>
      </a-row>
    </a-card>
    <a-card class="card" :bordered="false">
      <a-row :gutter="48">
          <a-col class="set-item" :sm="{span:12}" :lg="{span:12}" :xl="{span:12}">
            <span>监考至少</span>
            <a-input-number :min="1" :max="10" />
            <span>人</span>
          </a-col>
          <a-col class="set-item" :sm="{span:12}" :lg="{span:12}" :xl="{span:12}">
            <span>监考至少</span>
            <a-input-number :min="1" :max="10" />
            <span>人</span>
          </a-col>
          <a-col class="set-item" :sm="{span:12}" :lg="{span:12}" :xl="{span:12}">
            <span>主监考至少</span>
            <a-input-number :min="1" :max="10" />
            <span>人</span>
          </a-col>
          <a-col class="set-item" :sm="{span:12}" :lg="{span:12}" :xl="{span:12}">
            <span>现有主监考</span>
            <a-input-number :min="1" :max="10" />
            <span>人</span>
          </a-col>
          <a-col class="set-item" :sm="{span:12}" :lg="{span:12}" :xl="{span:12}">
            <span>男监考至少</span>
            <a-input-number :min="1" :max="10" />
            <span>人</span>
          </a-col>
          <a-col class="set-item" :sm="{span:12}" :lg="{span:12}" :xl="{span:12}">
            <span>现有男监考</span>
            <a-input-number :min="1" :max="10" />
            <span>人</span>
          </a-col>
          <a-col class="set-item" :sm="{span:12}" :lg="{span:12}" :xl="{span:12}">
            <span>女监考至少</span>
            <a-input-number :min="1" :max="10" />
            <span>人</span>
          </a-col>
          <a-col class="set-item" :sm="{span:12}" :lg="{span:12}" :xl="{span:12}">
            <span>现有女监考</span>
            <a-input-number :min="1" :max="10" />
            <span>人</span>
          </a-col>
      </a-row>
    </a-card>
</div>
</template>

<script>
// import moment from 'moment'
import { mapState } from 'vuex'

const selectArr = ['TYPE0126', 'TYPE0075', 'TYPE0125', 'TYPE0072']

export default {
  data () {
    return {
      advanced: true,
      loading: false,
      data: [],
      // 查询参数
      queryParam: {
        hzfs: 'yx'
      },
      postParams: {},
      selectMenu: {
        yx: [] // 院系
      }
    }
  },
  computed: {
    ...mapState({
      systemInfo: state => state.app.systemInfo,
      TYPE0126: state => state.app['TYPE0126'] // 年级
    })
  },
  created () {
    this.initSelectMenu()
    this.loadData()
    selectArr.forEach(v => {
      this.$store.dispatch('app/setDictionary', v)
    })
  },
  methods: {
    initSelectMenu () {
      let allRequest = [
        this.$api.base.collegeAll()
      ]
      Promise.all(allRequest).then(res => {
        this.selectMenu = {
          yx: res[0].data
        }
      })
    },
    // 分配监考
    handleDistribution () {
      console.log('分配监考')
    },
    // 清除已分配数据
    handleClear () {
      console.log('清除已分配数据')
    },
    // 改变时间
    handleDateChange () {

    }
  }
}
</script>

<style lang="less" scoped>
.card{
  margin-bottom: 20px;
}
.set-item{
  margin-bottom: 10px;
}
</style>
